<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<#include "/include/head_common.html"> 
<#include "/include/tree_table.html">
<title>菜单管理</title>
<script type="text/javascript">
	function updateSort() {
		loading('正在提交，请稍等...');
		$("#listForm").attr("action", "updateSort");
		$("#listForm").submit();
	}
	$(document).ready(function() {
		//根据tr的pId进行treeTable的操作
		$("#treeTable").treeTable({
			expandLevel : 3
		}).show();
	});
</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="list">菜单列表</a></li>
		<li><a href="edit">菜单添加</a></li>
	</ul>
	<form id="listForm" method="post">
		<#include "/include/message.html">
		<table id="treeTable"
			class="table table-striped table-bordered table-condensed hide">
			<thead>
				<tr>
					<th>名称</th>
					<th>操作</th>
					<th>链接</th>
					<th style="text-align: center;">排序</th>
					<th>可见</th>
					<th>权限标识</th>
				</tr>
			</thead>
			<tbody>
				<#list list as menu>
				<tr id="${menu.id}"
					pId="<#if menu.parentId!='1'>${menu.parentId!''}<#else>0</#if>">
					<td nowrap><i
						class="icon-<#if menu.icon?? && menu.icon!=''>${menu.icon!''}<#else> hide</#if>"></i>
						<a href="edit?id=${menu.id}">${menu.name!''}</a></td>
					<td nowrap><a href="edit?id=${menu.id!''}">修改</a> <a
						href="delete?id=${menu.id!''}"
						onclick="return confirmx('要删除该菜单及所有子菜单项吗？', this.href)">删除</a> <a
						href="edit?parentId=${menu.id!''}">添加下级菜单</a></td>
					<td title="${menu.href!''}">${menu.href!''}</td>
					<td style="text-align: center;"><input type="hidden"
						name="ids" value="${menu.id}" /> <input name="sorts" type="text"
						value="${menu.sort}"
						style="width: 50px; margin: 0; padding: 0; text-align: center;"></td>
					<td><#if menu.isShow=='1'>显示<#else>隐藏</#if></td>
					<td title="${menu.permission!''}">${menu.permission!''}</td>
					
				</tr>
				</#list>
			</tbody>
		</table>
		<div class="form-actions pagination-left">
			<input id="btnSubmit" class="btn btn-primary" type="button"
				value="保存排序" onclick="updateSort();" />
		</div>
	</form>
</body>
</html>